package cn.onecloud.tablet.xiaozhi.net;

import java.util.Arrays;
import java.util.List;

/**
 * Created by yin.he on 17-11-14.
 */

public enum Action {
    SCAN("scan"), LOGIN("login"), CANCEL("cancel"), AUTH_LOGIN("auth_login"), UNKNOWN("unknown");

    private String msg;

    Action(String msg) {
        this.msg = msg;
    }

    public String getMessage() {
        return this.msg;
    }

    public static Action getActionByMsg(String msg) {
        List<Action> actList = Arrays.asList(Action.values());
        for (Action act : actList) {
            if (act.getMessage().equalsIgnoreCase(msg)) {
                return act;
            }
        }
        return UNKNOWN;
    }
}